package net.hands.ado.db;

import java.util.Map;

import javax.swing.table.TableColumn;

import net.hands.ado.db.event.IDBListener;
import net.hands.common.ado.IParamsValue;

public interface IDBTableManager extends IDBManager {
	/**
	 * 获取表格元信息类
	 * 
	 * @return
	 */
	DBTable getDBTable();

	/**
	 * 扩展父类函数的参数
	 * 
	 * @param columns
	 * @param paramsValue
	 * @return
	 */
	Map<String, Object> executeQuery(String[] columns, IParamsValue paramsValue);

	/* select single */

	/**
	 * 根据指定条件返回Map实体对象。
	 * 
	 * @param paramsValue
	 * @return
	 */
	Map<String, Object> queryMap(IParamsValue paramsValue);

	/**
	 * 根据指定条件返回Map实体对象，并指定返回的列
	 * 
	 * @param columns
	 * @param paramsValue
	 * @return
	 */
	Map<String, Object> queryMap(String[] columns, IParamsValue paramsValue);

	/**
	 * 根据id返回实体对象
	 * 
	 * @param id
	 * @return
	 */
	Map<String, Object> getMap(Object id);

	/* select multi */

	IDBDataQuery queryMapSet(IParamsValue paramsValue);

	IDBDataQuery queryMapSet(String[] columns, IParamsValue paramsValue);

	/* update */

	int update(String[] columns, Map<String, Object>... maps);

	int update(Map<String, Object>... maps);

	int updateTransaction(String[] columns, Map<String, Object>... maps);

	int updateTransaction(IDBListener l, String[] columns,
			Map<String, Object>... maps);

	int updateTransaction(Map<String, Object>... maps);

	int updateTransaction(IDBListener l, Map<String, Object>... beans);

	/* insert */

	int insert(Map<String, Object>... maps);

	int insertTransaction(IDBListener l, Map<String, Object>... maps);

	int insertTransaction(Map<String, Object>... maps);

	/* delete */

	int delete(IParamsValue paramsValue);

	int deleteTransaction(IDBListener l, IParamsValue paramsValue);

	int deleteTransaction(IParamsValue paramsValue);

	/* utils */

	int count(IParamsValue paramsValue);

	int sum(String column, IParamsValue paramsValue);

	int max(String column, IParamsValue paramsValue);

	Object exchange(Object bean1, Object bean2, TableColumn order, boolean up);
}
